---
id: object
title: 对象类型
---


```ts
// 可以是逗号或者分号分割
//  { name: string, age: number; sex:number }

const obj: { name: string; age: number } = {
  name: "张三",
  age: 19,
};

// 函数中使用
function addUser(userInfo: {name:string, sex:number}){}